<template>
    <div class="avatar">
        <el-image :src="data.fileUrl" ref="image" :preview-src-list="imgList"></el-image>
    </div>
</template>

<script>
export default {
    name: "YiImage",
    props: {
        data: {
            type: Object
        },
        fileList: {
            type: Array
        }
    },
    methods: {
        handlePreview() {
            this.$refs.image.clickHandler();
        }
    },
    computed: {
        imgList() { // 过滤出所有image数据
            let imgList = this.fileList.filter(item => item.type === 'image');
            return imgList.map(item => item.fileUrl);
        }
    }
}
</script>
